<%@page import="com.hwadee.hello.entity.Student"%>
<%@page import="java.util.List"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>学生列表在此</title>
</head>

<body>
	<%-- <%@ include file="/WEB-INF/views/header.jsp" %> --%>
	<jsp:include page="/WEB-INF/views/header.jsp"/><br/>
	
	<a href="/hello/add" target= "_blank">添加学生</a><br/>


	<table>
		<caption>list</caption>
		<tr>
			<th>学号</th>
			<th>姓名</th>
			<th>性别</th>
			<th>年龄</th>
			<th>专业</th>
			<th>编辑</th>
		<c:choose>
			<c:when test="${not empty requestScope.pi }">
				<c:forEach items="${requestScope.pi.list }" var="stu">
						<tr>
							<td><c:out value="${stu.stuId}"/> </td>
							<td>${stu.stuName} </td>
							<td>${stu.stuSex} </td>
							<td>${stu.stuAge} </td>
							<td>${stu.stuPro} </td>
							<td><a href="/hello/delete/${stu.stuId}">删除</a>
								<a href="/hello/update/${stu.stuId}" target="_blank">修改</a></td>
						</tr>	
				</c:forEach>	
				<div>
				<c:if test="${pi.hasPreviousPage }">
					<a href="/hello/students?p=${pi.pageNum - 1 }">上一页</a>
				</c:if>
				<c:forEach begin="1" end="${pi.pages }" step="1" var="i">
					<a href="/hello/students?p=${i }" >${i }</a>
				</c:forEach>
				<c:if test="${pi.hasNextPage }">
					<a href="/hello/students?p=${pi.pageNum + 1 }">下一页</a>
				</c:if>
				当前第${pi.getPageNum() }页,有${pi.getSize() }条
				共${pi.total }条/共${pi.pages }页
				</div>
			</c:when>
			<c:otherwise>
				<c:import var="data" url="https://www.baidu.com"/>${data }
			</c:otherwise>
		</c:choose>

	</table>

</body>
</html>